package com.ruoyi.web.controller.tongban;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.tongban.domain.FaceSignDetail;
import com.ruoyi.tongban.service.IFaceSignDetailService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 考勤管理记录详情Controller
 * 
 * @author caiyanshan
 * @date 2021-04-08
 */
@RestController
@RequestMapping("/tongban/signdetail")
public class FaceSignDetailController extends BaseController
{
    @Autowired
    private IFaceSignDetailService faceSignDetailService;

    /**
     * 查询考勤管理记录详情列表
     */
    @PreAuthorize("@ss.hasPermi('tongban:signdetail:list')")
    @GetMapping("/list")
    public TableDataInfo list(FaceSignDetail faceSignDetail)
    {
        startPage();
        List<FaceSignDetail> list = faceSignDetailService.selectFaceSignDetailList(faceSignDetail);
        return getDataTable(list);
    }

    /**
     * 导出考勤管理记录详情列表
     */
    @PreAuthorize("@ss.hasPermi('tongban:signdetail:export')")
    @Log(title = "考勤管理记录详情", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FaceSignDetail faceSignDetail)
    {
        List<FaceSignDetail> list = faceSignDetailService.selectFaceSignDetailList(faceSignDetail);
        ExcelUtil<FaceSignDetail> util = new ExcelUtil<FaceSignDetail>(FaceSignDetail.class);
        return util.exportExcel(list, "signdetail");
    }

    /**
     * 获取考勤管理记录详情详细信息
     */
    @PreAuthorize("@ss.hasPermi('tongban:signdetail:query')")
    @GetMapping(value = "/{detailId}")
    public AjaxResult getInfo(@PathVariable("detailId") Long detailId)
    {
        return AjaxResult.success(faceSignDetailService.selectFaceSignDetailById(detailId));
    }

    /**
     * 新增考勤管理记录详情
     */
    @PreAuthorize("@ss.hasPermi('tongban:signdetail:add')")
    @Log(title = "考勤管理记录详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FaceSignDetail faceSignDetail)
    {
        return toAjax(faceSignDetailService.insertFaceSignDetail(faceSignDetail));
    }

    /**
     * 修改考勤管理记录详情
     */
    @PreAuthorize("@ss.hasPermi('tongban:signdetail:edit')")
    @Log(title = "考勤管理记录详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FaceSignDetail faceSignDetail)
    {
        return toAjax(faceSignDetailService.updateFaceSignDetail(faceSignDetail));
    }

    /**
     * 删除考勤管理记录详情
     */
    @PreAuthorize("@ss.hasPermi('tongban:signdetail:remove')")
    @Log(title = "考勤管理记录详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{detailIds}")
    public AjaxResult remove(@PathVariable Long[] detailIds)
    {
        return toAjax(faceSignDetailService.deleteFaceSignDetailByIds(detailIds));
    }
}
